import QtQuick 2.0

Rectangle{

    id:menuItem;
    //width: 200;
    //height: 40;

    property string strText: "";
    property string strIcon: "";

    signal selectTrig(int nItem);

    //anchors.fill: parent;

    Row{
        anchors.fill: parent;
        //z:0.1
        Rectangle{
            id:rectImg;
            height: parent.height;
            width: 40;

            //opacity: 0.5;
            //border.color: "gray";
            //border.width: 1;

            Image {
                id: menuItemImg;
                asynchronous: true;
                cache: false;

                anchors.fill: parent;

                fillMode: Image.PreserveAspectFit;

                source: strIcon;
                //source: "holder.ico";

            }

        }

        Rectangle{
            id:rectText;
            height: parent.height;
            width: parent.width-rectImg.width;

            //opacity: 0.5;

            Text{
                id:meunText;
                text: strText;

                width: 300;
                font.pixelSize: 20;
                anchors.left: parent.left;
                anchors.leftMargin: 5;
                anchors.verticalCenter: parent.verticalCenter;
            }
        }
    }

    MouseArea{
        id:click
        anchors.fill: parent;

        z:0.1

        onPressed:{
            selectTrig(1);

        }

        onReleased:{
            selectTrig(0);
        }

        onClicked: {
            selectTrig(2);
        }

    }

    Connections{
        target: menuItem;

        onSelectTrig:{

            if(nItem==1)
            {
                rectImg.color="lightblue";
                rectText.color="lightblue";

                meunText.color="white";
                meunText.font.bold=true;
            }else
            {
                rectImg.color="white";
                meunText.color="black";
                rectText.color="white";

                meunText.font.bold=false;
            }

        }
    }

}
